<?php
error_reporting(E_ALL ^ E_NOTICE);

set_time_limit(0);
date_default_timezone_set("PRC"); //timezone

$db1=mysql_connect("localhost","root","root"); 
mysql_query("set names 'utf8'",$db1); 
mysql_select_db('faithwar',$db1); 

$db2=mysql_connect('114.80.213.44','dev','triniti'); 
mysql_query("set names 'utf8'",$db2); 
mysql_select_db('faithwar',$db2); 

$update_query = mysql_query("SELECT userId,userName FROM tbaccount",$db2);

while($update = mysql_fetch_array($update_query))
{
   //mysql_query("set names 'utf8'",$db1); 
   mysql_query("insert INTO username ( username,deviceid) 
                    VALUES('$update[userName]','$update[userId]')",$db1) or die(mysql_error());
}
 print "Import successful!<br>";

?>